-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More-Granular Bailing #836
Conversation
This also encompasses my previous pull request, #835 . |
I don't mind it but I do think the use-case is pretty narrow, probably not worth adding to core, especially since most good modules are quite small bailing from the entire thing is generally not a big deal |
My use cases: I have suites where if one test fails, the rest of the tests in the suite are bound to fail. These are rather slow integration tests that use remote APIs. However, I still care about subsequent suites. It's nice to get a high level picture as fast as possible without grepping to suites that wont fail. Also, some of the subsequent tests in the suite might only fail due to the bad state left by the failing test. I also use mocha to do cross-browser functional testing, with a suite for each browser. If something fails in IE, more things are likely to fail in IE, but I still want to run the Chrome tests. Very useful when hooking up to CI or running full regressions, as well. |
+1 I'd also like to see this made available on the core |
-1 as well. we also have #1043 in now which could help |
This change gives you more control over the
bail
option for a suite. Currently, settingthis.bail()
in adescribe()
or--bail
through the CLI will cause mocha to stop executing all further tests, even tests in sibling or parent suites. This change allows you to turn bail on and off in suites and scope the bailing to only that suite and its descendant suites. Also, if a child suite turns off bailing, it will be run even if its parent bails. See the newbail2.js
spec file for concrete examples.I'm not sure if this is a merge-worthy feature, but it helps one of my use-cases in Mocha, where I want only certain suites to bail, and the bailing to be scoped.